package com.tech.koufu.model;

import org.json.JSONObject;

import android.os.Parcel;
import android.os.Parcelable;

public class TrackerUser implements Parcelable{

	
	public String trackId;
	public String trackName;
	public String trackGid;
	public String avator;
	public String zongup;
	public String renqi;
	public String ready;
	public String genzong;//ready already
	public String addTime;
	
	public TrackerUser(){}
	public TrackerUser(Parcel parcel){
		this.trackId = parcel.readString();
		this.trackName = parcel.readString();
		this.trackGid = parcel.readString();
		this.avator = parcel.readString();
		this.zongup = parcel.readString(); 
		this.renqi = parcel.readString();
		this.genzong = parcel.readString();
		this.addTime = parcel.readString();
	}
	
	public TrackerUser(JSONObject object){
		this.trackId = object.optString("tracker_id");
		this.trackName = object.optString("tracker_name");
		this.trackGid = object.optString("tracker_gid");
		this.avator = object.optString("avatar");
		this.zongup = object.optString("zongup");  
	}
	public TrackerUser(JSONObject object,int type){
		if(type==1){//牛人
			this.trackId = object.optString("userID");
			this.trackName = object.optString("username"); 
			this.avator = object.optString("avatar");
			this.zongup = object.optString("zongup");  
		}else if(type==2){
			this.trackId = object.optString("concern_user_id");
			this.trackName = object.optString("concern_user_name"); 
			this.avator = object.optString("avatar");
			this.renqi = object.optString("renqi");  
		}else if(type==3){
			this.trackId = object.optString("concern_user_id");
			this.trackName = object.optString("concern_user_name"); 
			this.avator = object.optString("avatar");
			this.addTime = object.optString("add_time");
			this.zongup = object.optString("zongup");  
		}else if(type==4){
			this.trackId = object.optString("user_id");
			this.trackName = object.optString("user_name"); 
			this.addTime = object.optString("add_time");
			this.avator = object.optString("avatar");
			this.zongup = object.optString("zongup");  
		}
		this.genzong = object.optString("genzong");
	}
	public static final Parcelable.Creator<TrackerUser> CREATOR = new Creator<TrackerUser>() {
		
		@Override
		public TrackerUser[] newArray(int size) { 
			return new TrackerUser[size];
		}
		
		@Override
		public TrackerUser createFromParcel(Parcel source) { 
			return new TrackerUser(source);
		}
	};
	@Override
	public int describeContents() { 
		return 0;
	}

	@Override
	public void writeToParcel(Parcel dest, int flags) { 
		dest.writeString(trackId);
		dest.writeString(trackName);
		dest.writeString(trackGid);
		dest.writeString(avator);
		dest.writeString(zongup);
		dest.writeString(renqi);
		dest.writeString(genzong);
		dest.writeString(addTime);
	}

	 

}
